﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<LogOnModel>" %>

<asp:Content ID="loginTitle" ContentPlaceHolderID="TitleContent" runat="server">
    Log On
</asp:Content>

<asp:Content ID="loginContent" ContentPlaceHolderID="MainContent" runat="server">
    <p>
        请输入您的用户名和密码。 如果您还没有注册请点击这里 <%= Html.ActionLink("注册", "Register") %> 
    </p>
    <%= Html.ValidationSummary("登录不成功。请更正错误，然后再试一次。")%>

    <% using (Html.BeginForm("LogOn", "Account", FormMethod.Post, new { id="logOnForm"}))
       { %>
        <div>
            <fieldset>
                <legend>用户登录</legend>
                <p>
                    <%= Html.LabelFor(m => m.UserName)%> <em class="red">*</em><br />
                    <%= Html.TextBoxFor(m => m.UserName)%>
                    <%= Html.ValidationMessageFor(m => m.UserName)%>
                </p>
                <p>
                    <%= Html.LabelFor(m => m.Password)%> <em class="red">*</em><br />
                    <%= Html.Password("Password")%>
                    <%= Html.ValidationMessageFor(m => m.Password)%>
                </p>
                <p>
                    <label for="ValidateText">验证码</label> <em class="red">*</em><br />
                    <img alt="ValidataImg" src="<%=Url.Action("ValidateImg","Account") %>" onclick="this.src='<%=Url.Action("ValidateImg","Account") %>?'+Math.random();"  /> 看不清?请点击图片 <br />
                    <%= Html.TextBox("ValidateText")%>
                    <%= Html.ValidationMessage("ValidateText")%>
                </p>
                <p>
                    <%= Html.CheckBox("rememberMe")%> <label class="inline" for="rememberMe">记往账户和密码?</label>
                </p>
                <p>
                    <input type="submit" value="登录" />
                </p>
                <p>
                    <input type="hidden" name="<%= ViewData["key"]%>" id="<%= ViewData["key"]%>" value="<%= ViewData["value"]%>" />
                </p>
            </fieldset>
        </div>
    <% } %>
    <script language="javascript" type="text/javascript">
        $("#logOnForm").validate({
            rules: {
                "UserName": { required: true, rangelength: [6, 10] },
                "Password": { required: true, rangelength: [6, 10] },
                "ValidateText": { required: true, rangelength: [6, 6] }
            },
            messages: {
                "UserName": { required: "请输入用户名。", rangelength: "用户名长度介于 6 和 10 之间的字符串。" },
                "Password": { required: "请输入密码。", rangelength: "密码长度介于 6 和 10 之间的字符串。" },
                "ValidateText": { required: "请输入验证码。", rangelength: "验证码长度为 6 位的字符串。" }
            },
            onkeyup: false
        });
   </script>
</asp:Content>
<asp:Content ContentPlaceHolderID="HeadLink" ID="headLink" runat="server">
   <%--<script language="javascript" type="text/javascript" src="/Scripts/jquery-1.3.2-vsdoc.js"></script>
   <script language="javascript" type="text/javascript" src="/Scripts/jquery-1.3.2.js"></script>
   <script language="javascript" type="text/javascript" src="/Scripts/jquery.validate.js"></script>--%>
   <script language="javascript" type="text/javascript" src="<%=Url.Resources("jqmvf") %>"></script>
   <style type="text/css">
       form lable.err
       { 
       	 margin-left:20px;
       }
    </style>
</asp:Content>
